﻿using System;
using System.Web.Mvc;
using System.Data.SqlTypes;
using System.Globalization;

namespace CruzDelSur.Helpers
{
    public static class LabelExtensions
    {
        public static string EtiquetaFor(this HtmlHelper helper, string target, string text)
        {
            return String.Format("<label for='{0}'>{1}</label>", target, text);

        }
        public static string Etiqueta(this HtmlHelper helper, string text)
        {
            return String.Format("<label>{0}</label>", text);

        }
        public static string Message(this HtmlHelper helper, object text)
        {
            if (text != null)
            {
                return String.Format("<span class=\"message-box\">{0}</span>", text.ToString());
            }
            else return String.Empty;

        }
        public static bool isDateNull(this HtmlHelper helper, DateTime dt)
        {
            return (dt <= SqlDateTime.MinValue.Value);
        
        }

        public static string formatoFecha(this HtmlHelper helper)
        {
            string format = CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern.ToLower();
            return format.Replace("yyyy", "yy");
        }

        public static string separadorNumeroDecimal(this HtmlHelper helper)
        {
            return CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator;
        }
    }
}